<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>v-bind:class</title>
  <script src="https://cdn.bootcss.com/vue/2.4.4/vue.js"></script>
  <style>
    .active{
      color: darkred;
      font-weight: bold;
    }
    .activeGreen{
      color:darkgreen;
      font-weight: bold;
    }
  </style>
</head>
<body>
  <h3>为html标签绑定样式单class属性</h3>
  <div id="myApp">
    <p v-bind:class="{active:isActive}">红色文本1</p>
    <p :class="{active:isActive}">红色文本2</p>
    <button @click="btnClick">去掉class</button>
  </div>
  <script>
    var myApp = new Vue({
      el:'#myApp',
      data:{
        isActive:true,
      },
      methods:{
        btnClick:function(){
          this.isActive = !this.isActive;
        }
      }
    })
  </script>
</body>
</html>